package com.ifast.demo.controller;


import java.net.InetAddress;
import java.net.UnknownHostException;

import org.xbill.DNS.*;

class IPConvertTask {
    private static String domain;

    public IPConvertTask(String d) {
        domain = d;
    }
    

    public String Convert() {
        InetAddress inetAddr;
        String ss = "";
        try {
			inetAddr = InetAddress.getByName(domain);
	        byte[] addr = inetAddr.getAddress();
	        for (int i = 0; i < addr.length; i++) {
	            if (i > 0)
	                ss += ".";
	            ss += addr[i] & 0xFF;
	        }
	        return ss;
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			//e.printStackTrace();
		}
        return "404";
    }
   
    
    public static void main(String[] args) throws Exception {
    	domain ="baidu.com";
    	//String r = Convert();
    	//System.out.println(r);
    }
}